<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>WebDeploy-远程文件管理工具</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="icon" href="images/favicon.ico">
    <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
    <link rel="stylesheet" href="../lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <style>
        .layui-card {
            border: 1px solid #f2f2f2;
            border-radius: 5px;
        }

        .icon {
            margin-right: 10px;
            color: #1aa094;
        }

        .icon-blue {
            color: #1e9fff !important;
        }

        .layuimini-qiuck-module {
            text-align: center;
            margin-top: 10px
        }

        .layuimini-qiuck-module a i {
            display: inline-block;
            width: 100%;
            height: 60px;
            line-height: 60px;
            text-align: center;
            border-radius: 2px;
            font-size: 30px;
            background-color: #F8F8F8;
            color: #333;
            transition: all .3s;
            -webkit-transition: all .3s;
        }

        .layuimini-qiuck-module a cite {
            position: relative;
            top: 2px;
            display: block;
            color: #666;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
            font-size: 14px;
        }

        .welcome-module {
            width: 100%;
            height: 210px;
        }

        .panel {
            background-color: #fff;
            border: 1px solid transparent;
            border-radius: 3px;
            -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
            box-shadow: 0 1px 1px rgba(0, 0, 0, .05)
        }

        .panel-body {
            padding: 10px
        }

        .panel-title {
            margin-top: 0;
            margin-bottom: 0;
            font-size: 12px;
            color: inherit
        }

        .label {
            display: inline;
            padding: .2em .6em .3em;
            font-size: 75%;
            font-weight: 700;
            line-height: 1;
            color: #fff;
            text-align: center;
            white-space: nowrap;
            vertical-align: baseline;
            border-radius: .25em;
            margin-top: .3em;
        }

        .main_btn > p {
            height: 40px;
        }

        .layui-bg-number {
            background-color: #F8F8F8;
        }

        .font-size {
            font-size: 15px;
        }
    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-row layui-col-space15">


            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-warning icon"></i>数据统计</div>
                    <div class="layui-card-body">
                        <div class="welcome-module">
                            <div class="layui-row layui-col-space10">
                                <div class="layui-col-xs6">
                                    <div class="panel layui-bg-number">
                                        <div class="panel-body">
                                            <div class="panel-title">
                                                <span class="label pull-right layui-bg-blue">文件大小</span>
                                                <h5>日志文件</h5>
                                            </div>
                                            <div class="panel-content">
                                                <h1 class="no-margins font-size">[[${logSize}]]/KB</h1>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-xs6">
                                    <div class="panel layui-bg-number">
                                        <div class="panel-body">
                                            <div class="panel-title">
                                                <span class="label pull-right layui-bg-blue">目录大小</span>
                                                <h5>临时上传/下载</h5>
                                            </div>
                                            <div class="panel-content">
                                                <h1 class="no-margins font-size">[[${tempSize}]]/KB</h1>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-xs6">
                                    <div class="panel layui-bg-number">
                                        <div class="panel-body">
                                            <div class="panel-title">
                                                <span class="label pull-right layui-bg-cyan">位置</span>
                                                <h5>日志目录</h5>
                                            </div>
                                            <div class="panel-content">
                                                <h1 class="no-margins font-size ">[[${logPath}]]</h1>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-xs6">
                                    <div class="panel layui-bg-number">
                                        <div class="panel-body">
                                            <div class="panel-title">
                                                <span class="label pull-right layui-bg-cyan">位置</span>
                                                <h5>临时目录</h5>
                                            </div>
                                            <div class="panel-content">
                                                <h1 class="no-margins font-size">[[${tempPath}]]</h1>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header"><i class="fa fa-credit-card icon icon-blue"></i>系统操作</div>
                    <div class="layui-card-body">
                        <div class="welcome-module">
                            <div class="layui-row layui-col-space10 layuimini-qiuck">
                                <div class="layui-col-xs3 layuimini-qiuck-module">
                                    <a href="javascript:;" onclick="_affirm('/refreshUserData')"
                                       data-icon="fa fa-user-plus">
                                        <i class="fa fa-refresh fa-users"></i>
                                        <cite>重新加载用户信息</cite>
                                    </a>
                                </div>
                                <div class="layui-col-xs3 layuimini-qiuck-module">
                                    <a href="javascript:;" onclick="_affirm('/refreshServerData')"
                                       data-icon="fa fa-server">
                                        <i class="fa fa-refresh fa-server"></i>
                                        <cite>重新加载服务信息</cite>
                                    </a>
                                </div>
                                <div class="layui-col-xs3 layuimini-qiuck-module">
                                    <a href="javascript:;" onclick="_affirm('/deleteLogFiles')"
                                       data-icon="fa fa-remove">
                                        <i class="fa fa-remove fa-file"></i>
                                        <cite>清空日志文件信息</cite>
                                    </a>
                                </div>
                                <div class="layui-col-xs3 layuimini-qiuck-module">
                                    <a href="javascript:;" onclick="_affirm('/deleteTempFiles')"
                                       data-icon="fa fa-remove">
                                        <i class="fa fa-remove fa-file-archive-o"></i>
                                        <cite>清空临时目录信息</cite>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    let $;
    let layer;
    layui.use(['form', 'jquery', 'layer'], function () {
        $ = layui.jquery, layer = layui.layer;

    });

    function _affirm(url) {
        layer.msg('你确定执行操作吗？', {
            time: 0
            ,btn: ['执行', '关闭']
            ,yes: function(index){
                layer.close(index);
                _method(url);
            }
        });
    }

    function _method(url) {
        let index = layer.load();
        $.ajax({
            url: url, type: "POST", async: false, success: function (result) {
                layer.close(index);
                let dataJson = JSON.parse(result);
                if (dataJson.code != 200) {
                    layer.msg(dataJson.msg);
                    return;
                }
                if (dataJson.data == true) {
                    layer.msg('操作成功！');
                } else {
                    layer.msg('操作失败!');
                }
            }
        });
        return false;
    }

</script>

</body>
</html>